package com.briup.sxau.bean;

import lombok.Data;

import javax.persistence.Entity;
import javax.persistence.Id;
import java.util.UUID;

@Data
@Entity(name = "t_user")
public class User {
    @Id
    private String id;
    private String username;
    private String password;


//    保证在类外部没有办法去设置用户id
    private void setId(String id) {

    }

    public User() {
        //使用UUID自己定义主键生成 保证非空且唯一
        this.id = UUID.randomUUID().toString().replace("-", "");
    }
}
